package cn.cdeden.knowledge.domain.dto;

import cn.cdeden.common.translation.annotation.Translation;
import cn.cdeden.common.translation.constant.TransConstant;
import cn.cdeden.knowledge.domain.SysMessage;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import io.github.linpeilie.annotations.AutoMapper;
import io.github.linpeilie.annotations.AutoMappers;
import lombok.*;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.Date;

/**
 * @author Yu.
 * @Description // 系统消息 模块
 * @Date 2023/11/29 13:29
 **/
@Data
@Builder
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = false)
@AutoMappers({@AutoMapper(target = SysMessage.class)})
public class SysMessageDto implements Serializable {
    private static final long serialVersionUID = 1L;

//    @ApiModelProperty(value = "编号")
    @TableId(type= IdType.AUTO)
    private Long id;


//    @ApiModelProperty(value = "操作人")
    private String operator;

//    @ApiModelProperty(value = "操作人昵称")
    @Translation(type = TransConstant.USER_ID_TO_NICKNAME,mapper = "operator")
    private String operatorName;

//    @ApiModelProperty(value = "是否已读")
    private boolean reading;

//    @ApiModelProperty(value = "接收人")
    private String recipient;

//    @ApiModelProperty(value = "接收人昵称")
    @Translation(type = TransConstant.USER_ID_TO_NICKNAME)
    private String recipientName;


//    @ApiModelProperty(value = "内容")
    private String content;

//    @ApiModelProperty(value = "已读时间")
    private Date readingTime;

//    @ApiModelProperty(value = "树节点编号")
    private String nodeId;

//    @ApiModelProperty(value = "消息类型")
    private String messageType;

//    @ApiModelProperty(value = "文档类型")
    private String fileType;

//    @ApiModelProperty(value = "文档类型")
    private String type;

//    @ApiModelProperty(value = "团队Id")
    private String teamId;

//    @ApiModelProperty(value = "创建日期")
    @TableField(fill= FieldFill.INSERT)
    private Date createTime;


//    @ApiModelProperty(value = "删除者")
    private String  deleteId;

//    @ApiModelProperty(value = "删除日期")
    private Date deleteTime;

//    @ApiModelProperty(value = "是否删除")
    private boolean  deleteState ;



    public void copyFrom(SysMessageDto source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
